{
  "nbformat": 4,
  "nbformat_minor": 0,
  "metadata": {
    "colab": {
      "name": "SG2-ADA-PT to Rosinality.ipynb",
      "private_outputs": true,
      "provenance": [],
      "authorship_tag": "ABX9TyPollY1zrqb3Vn6kffHzg/7",
      "include_colab_link": true
    },
    "kernelspec": {
      "name": "python3",
      "display_name": "Python 3"
    },
    "language_info": {
      "name": "python"
    },
    "accelerator": "GPU"
  },
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "view-in-github",
        "colab_type": "text"
      },
      "source": [
        "<a href=\"https://colab.research.google.com/github/dvschultz/stylegan2-ada-pytorch/blob/main/SG2_ADA_PT_to_Rosinality.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "-rrpitFAG9yV"
      },
      "source": [
        "## Setup"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "J8Oql7SOz2Rp"
      },
      "source": [
        "!nvidia-smi -L"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "p1tJvZaV0X-i"
      },
      "source": [
        "from google.colab import drive\n",
        "drive.mount('/content/drive')"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ZzahUXOmG6u8"
      },
      "source": [
        "## Installation"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "ny8AwNsy0R7I"
      },
      "source": [
        "!git clone https://github.com/dvschultz/stylegan2-ada-pytorch/\n",
        "!git clone https://github.com/rosinality/stylegan2-pytorch\n",
        "!pip install ninja"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "L7xG6qUQHBmB"
      },
      "source": [
        "## Convert"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "JdtO3hfN_4eA"
      },
      "source": [
        "%cd /content/stylegan2-ada-pytorch/"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "wxlMmoow06dp"
      },
      "source": [
        "!python export_weights.py /path/to/pkl /path/to/saved.pt"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "YF1Qu89_HCyl"
      },
      "source": [
        "## Test"
      ]
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "CafCxRc3AA18"
      },
      "source": [
        "%cd /content/stylegan2-pytorch/"
      ],
      "execution_count": null,
      "outputs": []
    },
    {
      "cell_type": "code",
      "metadata": {
        "id": "CHMH01S74kc7"
      },
      "source": [
        "!python generate.py --size 1024 --pics 20 --ckpt /path/to/saved.pt --truncation 0.5"
      ],
      "execution_count": null,
      "outputs": []
    }
  ]
}